using System;

namespace ObjectSerializers.Abstractions
{
    /// <summary>
    /// 序列化接口
    /// </summary>
    public interface ISerializerContext
    {
        /// <summary>
        /// 序列化
        /// </summary>
        /// <param name="value"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        ReadOnlyMemory<byte> Serialize<T>(T value);

        /// <summary>
        /// 反序列化
        /// </summary>
        /// <param name="buffer"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T Deserialize<T>(ReadOnlyMemory<byte> buffer);
    }
}